package org.example.user.service;

import org.example.user.service.impl.UserFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @description: UserFeignService
 * @author: e
 * @createDate: 2021/5/30
 */
@FeignClient(value = "service-user",fallback = UserFeignServiceFallback.class,path = "/user")
public interface UserFeignService {

    @GetMapping("/register/{email}/{password}/{code}")
    boolean register(@PathVariable("email") String email,
                     @PathVariable("password") String password,
                     @PathVariable("code") String code);

    /***
     * 判断邮箱是否被注册过；true代表已经注册过， false代表尚未注册
     **/
    @GetMapping("/isRegister/{email}")
    boolean isRegister(@PathVariable("email") String email);

    /***
     * 根据token查询⽤户登录邮箱接⼝
     **/
    @GetMapping("/info/{token}")
    String info(@PathVariable("token") String token);


    /***
     * 登录接⼝，验证⽤户名密码合法性，根据⽤户名和
     * 密码⽣成token，token存⼊数据库，并写⼊cookie
     * 中
     **/
    @GetMapping("/login/{email}/{password}")
    String login(@PathVariable("email") String email, @PathVariable("password") String password);

}
